﻿using System;
using Glue;
using Xunit;

namespace GlueTests.MappingTests
{
    public class When_adding_a_simplified_nested_relation
    {
        private readonly Mapping<DomainPerson, GuiPerson> mapping;

        public class GuiPerson
        {
            public GuiAddress Address { get; set; }

        }
        public class GuiAddress
        {
            public String City { get; set; }
        }

        public class DomainPerson
        {
            public DomainAddress Address { get; set; }
        }
        public class DomainAddress
        {
            public String City { get; set; }
        }

        public When_adding_a_simplified_nested_relation()
        {
            mapping = new Mapping<DomainPerson, GuiPerson>();
        }
        [Fact]
        public void Should_accept_it()
        {
            
            mapping.Relate(domain=>domain.Address.City,gui=>gui.Address.City);
        }

        [Fact]
        public void Should_accept_it_TowardsLeft()
        {
            mapping.RelateTowardsLeft(domain => domain.Address.City, gui => gui.Address.City);
        }

        [Fact]
        public void Should_accept_it_TowardsRight()
        {
            mapping.RelateTowardsRight(domain => domain.Address.City, gui => gui.Address.City);
        }
    }
}
